﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace T_Foundation.Infrastructure
{
    public interface IRepository<T> where T : class, new()
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> Addsync(T t);


        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAllAsync();


        /// <summary>
        /// 条件显示
        /// </summary>
        /// <param name="expre"></param>
        /// <returns></returns>
        Task<List<T>> GetAsync(Expression<Func<T, bool>> expre);


        /// <summary>
        /// 查找id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> GetModelAs(int id);


        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> Update(T t);

        Task<int> Delete(int id);


        Task<int> DeleteInfo(Expression<Func<T, bool>> info);

        Task<T> GetInfo(Expression<Func<T, bool>> info);


        Task<T> Get(int id);


        Task<List<T>> GetList();

        Task<int> UpdateAsyncRange(List<T> info);
    }
}
